// AboutDlg.cpp : implementation of the CBatchesDlg class
//
/////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#ifdef WIN32_PLATFORM_PSPC
#include "resourceppc.h"
#else
#include "resourcesp.h"
#endif
#include "batchesdlg.h"

LRESULT CBatchesDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
    AtlCreateMenuBar(m_hWnd, IDM_NEW_DELETE);

#ifdef WIN32_PLATFORM_WFSP
    if (hMenuBar != NULL)
        AtlActivateBackKey(hMenuBar);
#endif

    BOOL Ret = m_ImageList.Create(32, 32, ILC_COLORDDB | ILC_MASK, 2, 0);
    ATLASSERT(Ret == TRUE);

    CIcon icon;
    icon.LoadIcon(IDI_NEW_BATCH);
    int Result = m_ImageList.AddIcon(icon);
    ATLASSERT(Result != -1);
    icon.DestroyIcon();

    icon.LoadIcon(IDI_GROUPS);
    Result = m_ImageList.AddIcon(icon);
    ATLASSERT(Result != -1);
    icon.DestroyIcon();

    m_List.Attach(GetDlgItem(IDC_LIST));
    m_List.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT);
    m_List.SetImageList(m_ImageList, LVSIL_SMALL);

    CRect r;
    m_List.GetClientRect(&r);
    m_List.InsertColumn(0, NULL, LVCFMT_LEFT, r.Width());

    CString s;
    s.LoadString(IDS_NEW_BATCH);
    m_List.AddItem(0, 0, s, 0);

    m_List.SelectItem(0);
    m_List.SetFocus();

    return bHandled = FALSE;
}

LRESULT CBatchesDlg::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
    m_List.Detach();
    return bHandled = FALSE;
}

LRESULT CBatchesDlg::OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
    CRect r;
    m_List.GetClientRect(&r);
    m_List.SetColumnWidth(0, r.Width());
    return bHandled = FALSE;
}

